# -*- coding: utf-8 -*-
from Page.scanningPage import scanningPage
from selenium.webdriver.support.ui import Select
from selenium.webdriver import ActionChains
import time
class scanning():
    def __init__(self,driver):
        self.driver=driver
        self.scanningPage=scanningPage(self.driver)
    def grouplife(self):
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("head")
        time.sleep(2)
        self.scanningPage.groupBtn().click()
    def policymanage(self):
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraMenu")
        time.sleep(2)
        self.scanningPage.new().click()
    def scanning(self):
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraMenu")
        time.sleep(2)
        self.scanningPage.btnscanning().click()
    def scaning1(self,GrpPropNo):
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraInterface")
        time.sleep(2)
        self.scanningPage.inpGrpPropNo().send_keys(GrpPropNo)
        time.sleep(1)
        self.scanningPage.btnQuery().click()
        time.sleep(1)
        self.scanningPage.radTarget().click()
        time.sleep(1)
        self.scanningPage.btnSumbit().click()
        time.sleep(1)
        windows = self.driver.window_handles
        self.driver.switch_to.window(windows[-1])
        self.scanningPage.Submit().click()
        time.sleep(1)
        windows1 = self.driver.window_handles
        self.driver.switch_to.window(windows1[-1])
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraInterface")
        self.scanningPage.radTarget1().click()
        time.sleep(1)
        self.scanningPage.btngoin().click()
        time.sleep(1)
    def Policyifm(self,insurancepolicytype,PolicyAppDate):
        ActionChains(self.driver).double_click(self.scanningPage.btninsurancepolicytype()).perform()
        time.sleep(1)
        Select(self.scanningPage.seccodeselect()).select_by_visible_text(insurancepolicytype)
        time.sleep(1)
        self.scanningPage.inpPolicyAppDate().send_keys(PolicyAppDate)
        time.sleep(1)
        self.scanningPage.inpPolicyAppDate().click()
        time.sleep(1)
        self.scanningPage.btnSave().click()
        time.sleep(1)
        windows = self.driver.window_handles
        self.driver.switch_to.window(windows[-1])
        self.scanningPage.Submit().click()
        time.sleep(1)
        windows1 = self.driver.window_handles
        self.driver.switch_to.window(windows1[-1])
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
        self.scanningPage.btnPlanifmSave().click()
        windows = self.driver.window_handles
        self.driver.switch_to.window(windows[-1])
        self.scanningPage.Submit().click()
        time.sleep(1)













